<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>公司管理</title>

    <link href="../plugin/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugin/sweetalert-6.6.2/sweetalert2.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.css" rel="stylesheet"/>

    <script src="../plugin/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/local_zh.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/bootstrap-table.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../plugin/sweetalert-6.6.2/sweetalert2.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.formautofill.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.form.js"></script>
    <script src="../plugin/soul/utils3.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.serializejson.js"></script>
    <script src='../js/base.js'></script>
</head>

<body>
<script>
    $(function () {
        company = SingleTablePageCreateUtil.createInstance({
            module: 'company',
            defaultToolBar: {
                add: true,
                edit: true,
                remove: true,
                dialogSetting: {
                    modalWidth: 1000,
                    formTitle: 2,
                    formInput: 10,
                },
            },
            query: [{
                id: '',
                type: 'text',
                name: '商户Id',

            }, {
                type: 'text',
                name: '商户名称',
            }],
            columns: [{
                radio: true
            }, {
                field: 'companyId',
                title: '公司Id',
                align: 'center',
                add_form: {
                    type: 'hidden',
                },
                edit_form: {
                    type: 'hidden',
                }
            }, {
                field: 'name',
                title: '名称',
                align: 'center',
                add_form: {
                    type: 'text',
                },
                edit_form: {
                    type: 'text',
                }
            }, {
                field: 'phone',
                title: '公司联系方式',
                align: 'center',
                add_form: {
                    type: 'text',
                },
                edit_form: {
                    type: 'text',
                }
            }, {
                field: 'description',
                title: '备注',
                align: 'center',
                add_form: {
                    type: 'text',
                },
                edit_form: {
                    type: 'text',
                }
            }, {
                field: 'staffId',
                title: '公司负责人',
                align: 'center',
                formatter: function (value, row, index) {
                    return row.staffName;
                },
                add_form: {
                    type: 'select',
                    items: 'staffManager/selectItem'
                },
                edit_form: {
                    type: 'text',
                }
            }, {
                field: 'parentId',
                title: '父公司',
                align: 'center',
                formatter: function (value, row, index) {
                    return row.parentName;
                },
                add_form: {
                    type: 'text',
                },
                edit_form: {
                    type: 'text',
                }
            }, {
                field: 'photo',
                title: '营业执照',
                align: 'center',
                formatter: function (value, row, index) {
                    return row.parentName;
                },
                add_form: {
                    id: 'company_form_add_photo',
                    type: 'images',
                },
                edit_form: {
                    id: 'company_form_edit_photo',
                    type: 'images',

                }
            }],
        }); // 初始化完成

        // 初始化图片上传插件(fileuinput)
        $('#company_form_add_photo_fileinput').fileinput(
            {
                language: 'zh', // 设置语言
                uploadUrl: BaseConfig.preUrl
                + 'upload/image?module=goods&token='
                + BaseConfig.token, // 上传的地址
                allowedFileExtensions: ['jpg', 'gif', 'png'], // 接收的文件后缀
                fileActionSettings: {
                    showUpload: false,
                    showRemove: false,
                },
                showUpload: true, // 是否显示上传按钮
                showCaption: true, // 是否显示标题
                showRemove: true,
                showUploadedThumbs: true,
                maxFileCount: 5, // 表示允许同时上传的最大文件个数
                enctype: 'multipart/form-data',
                msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
            })
            .on(
                'fileuploaded',
                function (event, data, previewId, index) {
                    console.log(data);
                    var resp = data.response;
                    if (resp && resp.code == 200) {
                        var photostr = SetUtil.addString($(
                            '#company_form_add_photo').val(),
                            resp.obj);
                        console.log(photostr);
                        $('#company_form_add_photo').val(photostr);
                    }
                    ;
                }).on('filecleared', function (event) { // 清除文件
            $('#company_form_add_photo').val("");
        });
    });
</script>
</body>

</html>